package com.yxq.mdt.app.modules.personal.model;

import com.yxq.mdt.app.base.RespBase;
import com.yxq.mdt.app.modules.personal.bean.AddressBean;
import com.yxq.mdt.app.modules.personal.bean.AddressListBean;
import com.yxq.mdt.app.modules.personal.bean.UserIndexBean;
import com.yxq.mdt.app.net.API;

import java.util.List;

import io.reactivex.Observable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;

public interface AddressApi {
    /**
     * 收货地址-省市区数据
     */
    @GET(API.HOST_BASE_URL + "api/default/district")
    Observable<RespBase<List<AddressBean>>> district(@Query("access_token") String access_token);

    /**
     * 收货地址-列表
     */
    @GET(API.HOST_BASE_URL + "api/user/address-list")
    Observable<RespBase<String>> addressList(@Query("access_token") String access_token);

    /**
     * 收货地址-新增、编辑
     */
    @POST(API.HOST_BASE_URL + "api/user/address-save")
    @FormUrlEncoded
    Observable<RespBase<AddressListBean.ListBean>> addressSave(@Field("access_token") String access_token, @Field("address_id") String address_id, @Field("name") String name, @Field("mobile") String mobile, @Field("province_id") String province_id, @Field("city_id") String city_id, @Field("district_id") String district_id, @Field("detail") String detail);

    /**
     * 收货地址-删除
     */
    @GET(API.HOST_BASE_URL + "api/user/address-delete")
    Observable<RespBase<String>> addressDelete(@Query("access_token") String access_token, @Query("address_id") String address_id);

    /**
     * 收货地址-设置默认
     */
    @GET(API.HOST_BASE_URL + "api/user/address-set-default")
    Observable<RespBase<String>> setDefault(@Query("access_token") String access_token, @Query("address_id") String address_id);

    /**
     * 我的-页面数据
     */
    @GET(API.HOST_BASE_URL + "api/user/index")
    Observable<RespBase<UserIndexBean>> userIndex(@Query("access_token") String access_token);
}
